package orderProcessingProcess.server;

import orderProcessingProcess.model.Customer;

import javax.ws.rs.GET;
import javax.ws.rs.PUT;
import javax.ws.rs.POST;
import javax.ws.rs.DELETE;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.Consumes;
import javax.ws.rs.core.Response;


/** Customer Management Service (RESTfull Web Service) 
 * 
 * @author tom
 *
 */
public interface CustomerManagementService {

	/** get customer data
	 * @param id the customer id
	 * @return the customer object if found, Response.Status.NOT_FOUND otherwise
	 */
	@GET
    @Path("/{id}")
    @Produces({"application/xml","application/json"})
	public Customer getCustomer(@PathParam("id") String id);
	
	/** create a new customer
	 * @param customer
 	 * @param type MIME type of the supplied customer data
	 * @return Response.Status.OK if the customer was added, Response.Status.NOT_MODIFIED otherwise
	 */
	@POST
	@Path("/")
	@Consumes({"application/xml","application/json"})
	public Response addCustomer(Customer customer);		
		
	/** update customer data
	 * @param id id of the customer to be updated, must be equal to customer.getId()
	 * @param customer new customer data
	 * @param type MIME type of the supplied customer data
	 * @return Response.Status.OK if the customer data was updated, Response.Status.NOT_FOUND if there is no customer to update, Response.Status.NOT_MODIFIED if the update failed
	 */
	@PUT
	@Path("/{id}")
	@Consumes({"application/xml","application/json"})
	public Response updateCustomer(@PathParam("id") String id, Customer customer);
	
	/** delete the customer from the database
	 * @param id id of the customer to be deleted
	 * @return Response.Status.OK if the customer was deleted, Response.Status.NOT_FOUND otherwise
	 */
	@DELETE
	@Path("/{id}")
	public Response deleteCustomer(@PathParam("id") String id);	
}
